/*
 * Created by Administrator on 2017/3/31.
 */

var InvestRecord = React.createClass({
    getDefaultProps: function() {
        return{
            data:[]

        }
    },
    componentDidMount:function(){

    },
    render: function () {
        return(<div>
            {this.props.data.map(function (item,index) {
                var orderStatusText = '';
                var info = '';
                if (item.IsRefund == 1)
                    info = '，已退款';
                else
                    info = '，未退款';
                switch(item.UserCenterOrderStatus){
                    case 6:
                        orderStatusText = '处理中';
                        break;
                    case 10:
                        orderStatusText = '项目超募' + info;
                        break;
                    case 20:
                        orderStatusText = '回收完成';
                        break;
                    case 30:
                        orderStatusText = '回款中';
                        break;
                    case 40:
                        orderStatusText = '计息中';
                        break;
                    case 50:
                        orderStatusText = '已投标待起息';
                        break;
                    case 60:
                        orderStatusText = '项目流标' + info;
                        break;
                    case 70:
                        orderStatusText = '支付失败';
                        break;
                };
                var PayAmount = Number(item.PayAmount),_moreOver = false;
                if(PayAmount < 10000){
                    PayAmount = UFormatter.formatMoney(PayAmount, 2);
                }else{
                    PayAmount = UFormatter.formatMoney(PayAmount / 10000, 2);
                    _moreOver = true;
                }
                var Income = UFormatter.formatMoney(Number(item.Income),2);
                return (
                    <div className="item">
                        <h3>{item.ProjectName}</h3>
                        <ul className="clearfix">
                            <li>投资本金：<b>{PayAmount}</b>{_moreOver ? '万元':'元'}</li>
                            <li>预期收益：<b>{Income}</b>元</li>
                            <li>项目起息日：{item.ValueBegin}</li>
                            <li>项目到期日：{item.RepayBegin}</li>
                        </ul>
                        <a href={item.ProjectUrl} className="detail">投资详情&gt;&gt;</a>
                        <div className={"stauts "+(item.UserCenterOrderStatus ==10
                            ? "" : item.UserCenterOrderStatus ==60
                            ? "" : item.UserCenterOrderStatus ==70
                            ? "" : 'stauts-2')}>
                            <i className={"iconfont " + (item.UserCenterOrderStatus == 10
                                ? "icon-stautsf" : item.UserCenterOrderStatus == 60
                                ? "icon-stautsf" : item.UserCenterOrderStatus == 70
                                ? "icon-stautsf" : "icon-stautss")}></i>{orderStatusText}
                        </div>
                    </div>
                )
            })}
            </div>
            )

    }
})

module.exports = InvestRecord;